<template>
  <div>
    <!--这里是导航导航栏-->
    <van-nav-bar title="地址管理" left-text="返回" left-arrow @click-left="goback">
    </van-nav-bar>

    <van-popup v-model="show" position="bottom" :style="{ height: '70%' }" >
      <van-address-edit
          :area-list="areaList"
          show-postal
          show-delete
          show-set-default
          show-search-result
          :search-result="searchResult"
          :area-columns-placeholder="['请选择', '请选择', '请选择']"
          @save="onSave"
          @delete="onDelete"
          @change-detail="onChangeDetail"
      />
    </van-popup>
    <van-address-list
        v-model="chosenAddressId"
        :list="list"
        default-tag-text="默认"
        @add="onAdd"
        @edit="onEdit"
    />

  </div>

</template>
<script>
export default {
  data() {
    return {
      show:false,
      chosenAddressId: '1',
      list: [
        {
          id: '1',
          name: '张三',
          tel: '13000000000',
          address: '浙江省杭州市西湖区文三路 138 号东方通信大厦 7 楼 501 室',
          isDefault: true,
        },
        {
          id: '2',
          name: '李四',
          tel: '1310000000',
          address: '浙江省杭州市拱墅区莫干山路 50 号',
        },
      ],
    };
  },
  methods: {
    onAdd() {
      this.$toast('新增地址');
    },
    onEdit(item, index) {
      this.show = true;
      this.$toast('编辑地址:' + index);
    },
    goback() {
      this.$router.go(-1);//返回上一层
    }
  },
}
</script>

<style scoped>

</style>